<?php

namespace App\Admin\Extensions\Form;

use Encore\Admin\Form\Field;

class LCEditor extends Field
{
    public static $js = [
        '/js/Neditor/neditor.config.js',
        '/js/Neditor/neditor.all.min.js',
        '/js/Neditor/neditor.service.js',
        '/js/Neditor/i18n/zh-cn/zh-cn.js',
        '/js/Neditor/third-party/browser-md5-file.min.js',

    ];

    protected $view = 'admin.lceditor';

    public function render()
    {

        $str1 = str_replace(array("\r", "\n"), array('', '\n'), addslashes($this->value));
        $this->script = <<<EOT
                var html1='$str1';
                var ue1 = UE.getEditor('editor1',{
                    textarea : '{$this->column}',
                    initialFrameWidth:900,
                    zIndex : 0
                });
                ue1.ready(function() {
            //设置编辑器的内容
                ue1.setContent(html1);
});
EOT;

        return parent::render();
    }
}